﻿using System;
using System.Collections;
using System.Collections.Specialized;
using System.Runtime.Serialization;
using System.Web;

namespace NWebMock
{
    public class HttpClientCertificateWrapper : IHttpClientCertificate
    {
        #region Constructors

        public HttpClientCertificateWrapper(HttpClientCertificate clientCertificate)
        {
            if (clientCertificate == null)
            {
                throw new ArgumentNullException("clientCertificate");
            }

            this.innerClientCertificate = clientCertificate;
        }

        #endregion

        #region Fields

        private HttpClientCertificate innerClientCertificate = null;

        #endregion

        #region Properties

        public string[] AllKeys { get { return this.innerClientCertificate.AllKeys; } }

        public byte[] BinaryIssuer { get { return this.innerClientCertificate.BinaryIssuer; } }

        public int CertEncoding { get { return this.innerClientCertificate.CertEncoding; } }

        public byte[] Certificate { get { return this.innerClientCertificate.Certificate; } }

        public string Cookie { get { return this.innerClientCertificate.Cookie; } }

        public int Count { get { return this.innerClientCertificate.Count; } }

        public int Flags { get { return this.innerClientCertificate.Flags; } }

        public bool IsPresent { get { return this.innerClientCertificate.IsPresent; } }

        public string Issuer { get { return this.innerClientCertificate.Issuer; } }

        public bool IsValid { get { return this.innerClientCertificate.IsValid; } }

        public string this[int index] { get { return this.innerClientCertificate[index]; } }

        public string this[string name] { get { return this.innerClientCertificate[name]; } set { this[name] = value; } }

        public ICollection Keys { get { return this.innerClientCertificate.Keys; } }

        public int KeySize { get { return this.innerClientCertificate.KeySize; } }

        public byte[] PublicKey { get { return this.innerClientCertificate.PublicKey; } }

        public int SecretKeySize { get { return this.innerClientCertificate.SecretKeySize; } }

        public string SerialNumber { get { return this.innerClientCertificate.SerialNumber; } }

        public string ServerIssuer { get { return this.innerClientCertificate.ServerIssuer; } }

        public string ServerSubject { get { return this.innerClientCertificate.ServerSubject; } }

        public string Subject { get { return this.innerClientCertificate.Subject; } }

        public DateTime ValidFrom { get { return this.innerClientCertificate.ValidFrom; } }

        public DateTime ValidUntil { get { return this.innerClientCertificate.ValidUntil; } }

        #endregion

        #region Methods

        public void Add(NameValueCollection c)
        {
            this.innerClientCertificate.Add(c);
        }

        public void Add(string name, string value)
        {
            this.innerClientCertificate.Add(name, value);
        }

        public void Clear()
        {
            this.innerClientCertificate.Clear();
        }

        public void CopyTo(Array dest, int index)
        {
            this.innerClientCertificate.CopyTo(dest, index);
        }

        public string Get(int index)
        {
            return this.innerClientCertificate.Get(index);
        }

        public string Get(string field)
        {
            return this.innerClientCertificate.Get(field);
        }

        public IEnumerator GetEnumerator()
        {
            return this.innerClientCertificate.GetEnumerator();
        }

        public string GetKey(int index)
        {
            return this.innerClientCertificate.GetKey(index);
        }

        public void GetObjectData(SerializationInfo info, StreamingContext context)
        {
            this.innerClientCertificate.GetObjectData(info, context);
        }

        public string[] GetValues(int index)
        {
            return this.innerClientCertificate.GetValues(index);
        }

        public string[] GetValues(string name)
        {
            return this.innerClientCertificate.GetValues(name);
        }

        public bool HasKeys()
        {
            return this.innerClientCertificate.HasKeys();
        }

        public void OnDeserialization(object sender)
        {
            this.innerClientCertificate.OnDeserialization(sender);
        }

        public void Remove(string name)
        {
            this.innerClientCertificate.Remove(name);
        }

        public void Set(string name, string value)
        {
            this.innerClientCertificate.Set(name, value);
        }

        #endregion

        #region ICollection Members

        bool ICollection.IsSynchronized { get { return ((ICollection)this.innerClientCertificate).IsSynchronized; } }

        object ICollection.SyncRoot { get { return ((ICollection)this.innerClientCertificate).SyncRoot; } }

        #endregion
    }
}
